import pandas as pd


def update_excel_订单(file_path):
    df = pd.read_excel(file_path, engine='openpyxl')
    # 将指定列数据为空的行修改为0
    df['订单商品重量'] = df['订单商品重量'].fillna(0)
    # 保存excel
    df.to_excel(file_path, index=False)


def update_excel_库存(file_path):
    df = pd.read_excel(file_path, engine='openpyxl')
    # 重命名指定列
    df.rename(columns={'备货天数下限': '安全天数下限', '备货天数上限': '安全天数上限'}, inplace=True)
    # 保存excel
    with pd.ExcelWriter(file_path, engine='xlsxwriter', engine_kwargs={'options': {'strings_to_urls': False}}) as writer:
        df.to_excel(writer, index=False)


# update_excel_库存(r"C:\商品库存\2024-04-20\商品库存.xlsx")
